<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8">
    <title>订牛奶管理系统</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" href="/static/lib/bootstrap5.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/stylesheets/theme.css">
    <link rel="stylesheet" href="/static/lib/font-awesome/css/font-awesome.css">
    <script src="/static/lib/jquery-1.7.2.min.js" charset="UTF-8" type="text/javascript"></script>
    <script src="/static/js/dictionary/list.js" charset="UTF-8" type="text/javascript"></script>
    <style type="text/css">
        #line-chart {
            height: 300px;
            width: 800px;
            margin: 0px auto;
            margin-top: 1em;
        }

        .brand {
            font-family: georgia, serif;
        }

        .brand .first {
            color: #ccc;
            font-style: italic;
        }

        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>
</head>

<body class="">
<%@ include file="../top.jsp" %>
<%@ include file="../left.jsp" %>


<div class="content">

    <div class="hidden">
    </div>

    <div class="container-fluid">
        <div class="row-fluid">
            <br/>

            <form action="/dictionary/list" id="goFind" method="POST" style="display: inline-block;">
                <input type="text" name="name" id="name" value="${tj.name}" placeholder="分类名称">
                结构类型:<select name="type" class="type">
                <option class='' value="0">全部</option>
                <option ${tj.type == 1 ? "selected" : ""} class='' value="1">列表结构</option>
                <option ${tj.type == 2 ? "selected" : ""} class='' value="2">树形结构</option>
            </select>
                <!-- 页面大小 -->
                <input type="hidden" id="fpageSize" name="pageSize">
                <!-- 获取当前页 -->
                <input type="hidden" id="fpageNum" name="pageNum" value="${data.pageNum}">
            </form>

            <button onclick="tests()" class="btn btn-primary">测试</button>

            <button onclick="find()" class="btn btn-primary">查询</button>
            <button onclick="save()" class="btn btn-primary">添加</button>
            <button onclick="deleteBatch()" class="btn btn-primary">批量删除</button>

            <div class="well">
                <table class="table">
                    <thead>
                    <tr>
                        <th></th>
                        <th>编号</th>
                        <th>分类名称</th>
                        <th>字典代码</th>
                        <th>结构类型</th>
                        <th>所属系统</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody class="tbodyInfo">

                    <c:forEach items="${data.getList()}" var="dictionary" varStatus="status">
                        <tr>
                            <td><input type='checkbox' name='dictionaryCheck' value="${dictionary.id}"></td>
                            <td>${dictionary.id}</td>
                            <td>${dictionary.name}</td>
                            <td>${dictionary.dicCode}</td>
                            <td>${dictionary.type == 1? "列表结构":"树形结构"}</td>
                            <td>${dictionary.company}</td>
                            <td>
                                <button class='btn btn-primary' onclick='details(${dictionary.id})'>查看</button>
                                <button class='btn btn-primary' onclick='edit(${dictionary.id})'>编辑</button>
                                <button class='btn btn-primary' onclick='deleteById(${dictionary.id})'>删除</button>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <div style="text-align: center;" class="page_div">
                    <input type="button" onclick="pageTurning(1)" class="btn btn-primary page sgrr firstPage"
                           value="首页"/>
                    <input type="button" onclick="pageTurning(${data.prePage})" class="btn btn-primary page sgrr upPage"
                           value="上一页"/>
                    <input type="button" onclick="pageTurning(${data.nextPage})"
                           class="btn btn-primary page sgrr lowerPage" value="下一页"/>
                    <input type="button" onclick="pageTurning(${data.pages})"
                           class="btn btn-primary page sgrr totalPage" value="尾页"/>

                    <label style="display: inline-block">${data.pageNum}/${data.pages}</label>

                    <select class="xuanzhepage">
                        <option value="10">10</option>
                        <option value="20">20</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                    </select>
                </div>
            </div>
            <div class="pagination">

            </div>

        </div>
    </div>
</div>


<script src="/static/lib/bootstrap5.0.0/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $(".xuanzhepage").val(${data.pageSize})
    });

</script>

</body>
</html>
